package alf.common.util;

import java.io.File;
import java.io.FileFilter;

public class SimpleFileNameFilter implements FileFilter {
	
	private String ext = null;
	private boolean acceptDirs = false;

	public void setExt(String ext) {
		this.ext = ext;
	}

	public String getExt() {
		return ext;
	}
	public void setAccepDirs(boolean value) {
		acceptDirs = value;
	}

	public boolean accept(File f) {
		if (f.isDirectory()) {
			return acceptDirs;
		}
		if (ext != null) {
			String fin = "." + ext;
			String name = f.getName();
			if (name.contains(fin)) {

			} else {
				return false;
			}
		} 
		return true;
	}

}
